package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.it.project.ProjectSystemRelation;
import com.glsc.ngateway.common.base.domainmapper.ProjectSystemRelationMapper;
import com.glsc.ngateway.common.api.platform.dto.it.project.ProjectSystemRelationDto;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author xuchang
 */
public class ProjectSystemRelationConverter {
    public static ProjectSystemRelationDto do2Dto(ProjectSystemRelation hostDo){
        return ProjectSystemRelationMapper.INSTANCE.domain2dto(hostDo);
    }

    public static List<ProjectSystemRelationDto> do2Dto(List<ProjectSystemRelation> hostDoList){
        return CollectionUtils.isEmpty(hostDoList) ? java.util.Collections.emptyList() : hostDoList.stream().map(ProjectSystemRelationConverter::do2Dto).collect(Collectors.toList());
    }

    public static ProjectSystemRelation dto2Do(ProjectSystemRelationDto hostDto){
        return ProjectSystemRelationMapper.INSTANCE.dto2domain(hostDto);
    }

    public static List<ProjectSystemRelation> dto2Do(List<ProjectSystemRelationDto> hostDtoList){
        return CollectionUtils.isEmpty(hostDtoList) ? java.util.Collections.emptyList() : hostDtoList.stream().map(ProjectSystemRelationConverter::dto2Do).collect(Collectors.toList());
    }
}
